﻿Imports Miron.Framework.Seguranca.Dominio

Namespace Seguranca.Servico

    ''' <summary>
    ''' Interface de autorização de serviço
    ''' </summary>
    ''' <remarks></remarks>
    Public Interface IAutorizacaoServico

        Property TabelaUsusiga() As String

        ''' <summary>
        ''' Autoriza a requisição
        ''' </summary>
        ''' <param name="_path">String</param>
        ''' <returns>Boolan</returns>
        ''' <remarks></remarks>
        Function AutorizaRequest(ByVal _path As String) As Boolean

        ''' <summary>
        ''' Autoriza a Operação
        ''' </summary>
        ''' <param name="_tipoOperacao">classe TipoOperacao</param>
        ''' <returns>Boolean</returns>
        ''' <remarks></remarks>
        Function AutorizaOperacao(ByVal _tipoOperacao As TipoOperacao) As Boolean

        ''' <summary>
        ''' Busca o Papel pai
        ''' </summary>
        ''' <returns>Lista(classe Papel)</returns>
        ''' <remarks></remarks>
        Function BuscarPapeis() As IList(Of Papel)

        Function BuscarPapelPorNome(ByVal nome As String) As Papel

        Function BuscarPapeisPorNome(ByVal nome As String) As IList(Of Papel)

        ''' <summary>
        ''' Não utilizar esse método. Está mal definido. 
        ''' O que ele faz na verdade é ou buscar por ID ou por Nome.
        ''' </summary>
        ''' <param name="_papel"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Function BuscarPapeisPorPapel(ByVal _papel As Papel) As List(Of Papel)

        Function BuscarPapelPorId(ByVal _id As Long) As Papel

        ''' <summary>
        ''' Busca o Papel pai pelo mnemonico
        ''' </summary>
        ''' <param name="_mnemonico">String</param>
        ''' <returns>classe Papel</returns>
        ''' <remarks></remarks>
        Function BuscarPapelPorMnemonico(ByVal _mnemonico As String) As Papel

        ''' <summary>
        ''' Busca as Permissoes 
        ''' </summary>
        ''' <returns>Lista(classe Permissao)</returns>
        ''' <remarks></remarks>
        Function BuscarPermissoes() As IList(Of Permissao)

        ''' <summary>
        ''' Busca os Recursos
        ''' </summary>
        ''' <returns>classe Recurso</returns>
        ''' <remarks></remarks>
        Function BuscarRecursos() As System.Collections.Generic.IList(Of Dominio.Recurso)

        ''' <summary>
        ''' Retorna as permissões pelo Tipo do Módulo e pelo Tipo da Permissão
        ''' </summary>
        ''' <param name="_modulo">classe TipoModulo</param>
        ''' <param name="_tipoPermissao">classe TipoPermissao</param>
        ''' <returns>Lista(classe Permissao)</returns>
        ''' <remarks></remarks>
        Function BuscarPermissoesPorModuloETipo(ByVal _modulo As TipoModulo, ByVal _tipoPermissao As TipoPermissao) As System.Collections.Generic.IList(Of Dominio.Permissao)

        ''' <summary>
        ''' Retorna as permissoes atravez do Papel, do Tipo de Módulo e do Tipo da Permissão.
        ''' </summary>
        ''' <param name="_papel">classe Papel</param>
        ''' <param name="_modulo">classe TipoModulo</param>
        ''' <param name="_tipoPermissao">classe TipoPermissao</param>
        ''' <returns>Lista(classe Permissao)</returns>
        ''' <remarks></remarks>
        Function BuscarPermissoesPorPapelEModuloETipo(ByVal _papel As Papel, ByVal _modulo As TipoModulo, ByVal _tipoPermissao As TipoPermissao) As IList(Of Permissao)

        ''' <summary>
        ''' Retorna a permissão pelo ID
        ''' </summary>
        ''' <param name="_id">Long</param>
        ''' <returns>classe Permissao</returns>
        ''' <remarks></remarks>
        Function BuscarPermissaoPorId(ByVal _id As Long) As Permissao

        ''' <summary>
        ''' Retorna o recurso pelo ID
        ''' </summary>
        ''' <param name="_id">Long</param>
        ''' <returns>classe Recurso</returns>
        ''' <remarks></remarks>
        Function BuscarRecursoPorId(ByVal _id As Long) As Recurso

        ''' <summary>
        ''' Retorna o Usuário pelo ID
        ''' </summary>
        ''' <param name="_id">Long</param>
        ''' <returns>classe Usuario</returns>
        ''' <remarks></remarks>
        Function BuscarUsuarioPorId(ByVal _id As Long) As Usuario

        Function BuscarIDUsuarioLogado() As Nullable(Of Long)

        ''' <summary>
        ''' Busca recursos cujas permissões são herdadas do papel pai e de outros ancestrais.
        ''' </summary>
        ''' <remarks>
        ''' Os recursos aos quais o papel e seus ancestrais têm restrição não são retornados.
        '''  </remarks>
        Function BuscarPermissoesHerdadas(ByVal _papel As Papel) As IList(Of Recurso)

        ''' <summary>
        ''' Busca restrições a recursos do papel e de seus ancestrais.
        ''' </summary>
        Function BuscarRestricoes(ByVal _papel As Papel) As IList(Of Recurso)

        ''' <summary>
        ''' Sub para salvar o Papel.
        ''' </summary>
        ''' <param name="_papel">classe Papel</param>
        ''' <remarks></remarks>
        Sub SalvarPapel(ByVal _papel As Papel)

        Sub BloquearUsuario(ByVal _usuarioABloquear As Usuario, ByVal _executor As Usuario, ByVal _motivo As String)

        Sub DesbloquearUsuario(ByVal _usuarioADESBloquear As Usuario, ByVal _executor As Usuario, ByVal _motivo As String)

        Function UsuarioLogadoTemPapel(ByVal _idPapel As Integer) As Boolean

        Function BuscarExtensoes(ByVal _idPapel As Integer) As IList(Of Papel)


        Function BuscarUsuariosPorPapel(ByVal _usuario As Usuario, _
                                        ByVal _papel As Papel) As IList(Of Usuario)

        Function BuscarUsuariosPorPapel(ByVal _papel As Papel) As IList(Of Usuario)

        Function BuscarUsuariosPorNome(ByVal _nome As String) As IList(Of Usuario)

        Function BuscarUsuariosPorEmail(ByVal _email As String) As IList(Of Usuario)

        Function BuscarUsuariosPorNomeEmailLogin(ByVal _nome As String, ByVal _email As String, ByVal _codigoExterno As String) As IList(Of Usuario)

        Function BuscarUsuariosPorPapelEUsuario(ByVal _papel As Papel, _
                                                ByVal _usuario As Usuario) As IList(Of Usuario)

        Function BuscarPapeisUsuarioPorPapel(ByVal _idPapel As Integer) As IList(Of PapelUsuario)

        Sub ExcluirPapel(ByVal _papel As Papel)

        Sub SalvarUsuario(ByRef _login As String, ByVal _email As String, ByVal _nome As String, ByVal _telefone As String, Optional ByVal _papeis As IList(Of Papel) = Nothing)

        Sub AlterarUsuarioNomeTelefoneEmail(ByRef _usuario As Usuario)

        Sub AlterarUsuarioAdicionarPapel(ByRef _usuario As Usuario, ByVal _papel As Papel)

        Function BuscarHistoricoOperacao(ByVal _usuario As Usuario) As IList(Of AtualizacaoUsuario)

        Sub ReverterExclusaoDePapel(ByVal _papel As Papel)

        Function PapelEhDescendenteDeMnemonico(ByVal _papel As Papel, ByVal _mnemonico As String) As Boolean

        Function BuscarRecursoPelaUrl(ByVal _url As String) As Recurso

    End Interface

End Namespace
